package com.lc202407;

public class Solution2125 {
    public int numberOfBeams(String[] bank) {
        int total = 0;
        int start = 0;
        for (String s : bank) {
            int num = 0;
            int length = s.length();
            for (int i = 0; i < length; i++) {
                if (s.charAt(i) == '1') {
                    num++;
                }
            }
            total += start * num;
            start = num != 0 ? num : start;
        }
        return total;
    }
}
